import java.util.ArrayList;

public class BuildingList  {

	public ArrayList<Building> list;
	
	public BuildingList() {
		list = new ArrayList<Building>();
	}
	public void push (Building e) {
		list.add(e);
	}
	public Building search(int __x, int __y) {
		Building b = null;
		
		for(int i=0; i<list.size(); i++)
		{
			int cnt=list.get(i).getNum_of_RoadMap();
			for(int j=0; j<cnt; j++)
			{	int x=list.get(i).getRm(j).getXY()[0];
				int y=list.get(i).getRm(j).getXY()[1];

				if (x == __x && y == __y) {
					b = list.get(i);
					break;
				}
			}
			
			if (b != null) {
				break;
			}
		}
		
		return b;
	}
	
	public Building search(String __name) {
		Building b = null;
		
		for(int i=0; i<list.size(); i++)
		{
			String name = list.get(i).getName();

			if (name == __name) {
				b = list.get(i);
				break;
			}
		}
		
		return b;
	}	
}
